.macro PlayChannel(chanId, dataPtr)
{
    lda #chanId
    ldx #<dataPtr
    ldy #>dataPtr
    jsr init_channel
}

.macro StopChannel(chanId)
{
.label sid_ptr = zero_page_start
    // early out if channel is inactive
    lda [channel_state_array + chanId*channel_state_size + channel_tempo]
    beq end

    // deactivate channel
    lda #0
    sta [channel_state_array + chanId*channel_state_size + channel_tempo]

    // set relevant SID range to 0
    lda [channel_state_array + chanId*channel_state_size + channel_sid_ptr_lo]
    sta sid_ptr
    lda [channel_state_array + chanId*channel_state_size + channel_sid_ptr_hi]
    sta sid_ptr+1
    jsr stop_sid_channel
        
end:
}
